package net.htjs.juc.thread;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ThreadInterrupt {

    public static void main(String[] args) {
        Thread thread = new Thread(() ->{
            try {
                log.info("running");
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                log.info("wake up");
                e.printStackTrace();
            }
        }, "Thread-1");
        thread.start();
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("interrupt:");
        thread.interrupt();
        log.info("打断标记:{}", thread.isInterrupted());
    }


}
